<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>php常用内置函数</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
	<div class="container">
		<div class="row">
			<table class="table table-striped table-bordered table-hover table-condensed">
				<tr>
					<td>例子</td>
					<td>运行结果</td>
					<td>说明</td>
				</tr>
				<!-- <tr>
					<td>======>函数</td>
					<td>substr($string,'参数1','参数2')</td>
					<td>返回字符串的一部分</td>
				</tr> -->
				<tr>
					<td>substr("Hello world",6)</td>
					<td>{php}echo substr("Hello world",6);{/php}</td>
					<td>从字符窜第6个位置开始，截取至末尾</td>
				</tr>
				<tr>
					<td>substr("Hello world",4)</td>
					<td>{php}echo substr("Hello world",4);{/php}</td>
					<td>从字符窜第4个位置开始，截取至末尾</td>
				</tr>
				<tr>
					<td>substr("Hello world",0,2)</td>
					<td>{php}echo substr("Hello world",0,2);{/php}</td>
					<td>从字符窜第0个位置开始，截取2个字符长度</td>
				</tr>
				<tr>
					<td>substr("Hello world",4,3)</td>
					<td>{php}echo substr("Hello world",4,3);{/php}</td>
					<td>从字符窜第4个位置开始，截取3个字符长度</td>
				</tr>
				<tr>
					<td>substr("Hello world",4,5)</td>
					<td>{php}echo substr("Hello world",4,5);{/php}</td>
					<td>从字符窜第4个位置开始，截取5个字符长度</td>
				</tr>
				<tr>
					<td>substr("Hello world",4,-1)</td>
					<td>{php}echo substr("Hello world",4,-1);{/php}</td>
					<td>从字符窜第4个位置开始，截取至倒数第1个字符前</td>
				</tr>
				<tr>
					<td>substr("Hello world",4,-3)</td>
					<td>{php}echo substr("Hello world",4,-3);{/php}</td>
					<td>从字符窜第4个位置开始，截取至倒数第3个字符前</td>
				</tr>
				<tr>
					<td>substr("Hello world",-4)</td>
					<td>{php}echo substr("Hello world",-4);{/php}</td>
					<td>从字符窜倒数第4个位置开始，截取至末尾</td>
				</tr>
				<tr>
					<td>substr("Hello world",-7)</td>
					<td>{php}echo substr("Hello world",-7);{/php}</td>
					<td>从字符窜倒数第7个位置开始，截取至末尾</td>
				</tr>
				<tr>
					<td>substr("Hello world",-7,3)</td>
					<td>{php}echo substr("Hello world",-7,3);{/php}</td>
					<td>从字符窜倒数第7个位置开始，截取3个字符长度</td>
				</tr>
				<tr>
					<td>substr("Hello world",-7,5)</td>
					<td>{php}echo substr("Hello world",-7,5);{/php}</td>
					<td>从字符窜倒数第7个位置开始，截取5个字符长度</td>
				</tr>
				<tr>
					<td>substr("Hello world",-7,-1)</td>
					<td>{php}echo substr("Hello world",-7,-1);{/php}</td>
					<td>从字符窜倒数第7个位置开始，截取至倒数第1个字符前</td>
				</tr>
				<tr>
					<td>substr("Hello world",-7,-3)</td>
					<td>{php}echo substr("Hello world",-7,-3);{/php}</td>
					<td>从字符窜倒数第7个位置开始，截取至倒数第3个字符前</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<ul>
				<li><a href="https://getbootstrap.net/">Bootstrap4官网</a></li>
				<li><a href="https://www.runoob.com/bootstrap4/bootstrap4-tutorial.html">Bootstrap4菜鸟教程</a></li>
			</ul>
		</div>
	</div>
</body>
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.js"></script>
</html>